home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Graphics / Utilities / Movie Conversion / Movie Conversion / background_2659.xml next >
Extensible Markup Language  |  1994-04-30  |  18KB  |  13 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE background PUBLIC "-//Apple, Inc.//DTD background V 2.0//EN" "" >
  3. <background>
  4.     <id>2659</id>
  5.     <filler1>0</filler1>
  6.     <cantDelete> <false /> </cantDelete>
  7.     <showPict> <true /> </showPict>
  8.     <dontSearch> <false /> </dontSearch>
  9.     <link rel="stylesheet" type="text/css" href="stylesheet_3103.css" />
  10.     <name>Conversions</name>
  11.     <script>---- Definitions of valid pixel depths, their names, bit numbers-- and common ordering.--Function PixelDepthNames-- returns a list of names of the valid pixel depths.Return ¬¨"Black & white" & return & ¬¨"4 colours" & return & ¬¨"16 colours" & return & ¬¨"256 colours" & return & ¬¨"Thousands of colours" & return & ¬¨"Millions of colours" & return & ¬¨"Millions of colours+" & return & ¬¨"4 greys" & return & ¬¨"16 greys" & return & ¬¨"256 greys"End PixelDepthNamesFunction PixelDepths-- returns the list of valid pixel depth values.Return ¬¨"1" & return & ¬¨"2" & return & ¬¨"4" & return & ¬¨"8" & return & ¬¨"16" & return & ¬¨"24" & return & ¬¨"32" & return & ¬¨"34" & return & ¬¨"36" & return & ¬¨"40"End PixelDepthsFunction PixelDepthBits-- returns the list of codec flag bit numbers corresponding-- to the valid pixel depths.Return ¬¨"32" & return & ¬¨"31" & return & ¬¨"30" & return & ¬¨"29" & return & ¬¨"28" & return & ¬¨"26" & return & ¬¨"27" & return & ¬¨"24" & return & ¬¨"23" & return & ¬¨"22"End PixelDepthBits---- Common parts of conversion code--Function NewMovieFromSoundResource SoundFileName, SoundName, MovieFileName-- creates a movie from a sound resource.Global MovieOKPut PushCleanup() into CleanupLevelPut false into MovieOK -- initial assumptionPut empty into TheMovie--Get OpenResFile(SoundFileName)If it < 0 thenAnswer "Error" && it && "opening sound file."PopCleanup CleanupLevelExit NewMovieFromSoundResourceElse if it = 0 thenAnswer "Hmm, that file is already open." with "Uh-oh"PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfPut it into SoundFileAddCleanup "CloseResFile" && itGet GetNamedResource(SoundFile, "snd ", SoundName, true)If it ‚⧠0 thenAnswer "Error" && it && "loading sound resource."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfPut it into TheSoundHLock TheSoundPut SndParseCommands(HDeref(TheSound)) into TheSoundCommandsPut 80 into soundCmdPut 81 into bufferCmdPut empty into TheSoundDataRepeat with i = 1 to the number of lines in TheSoundCommands-- look for a command which references some sampled soundGet line i of TheSoundCommandsIf item 1 of it = soundCmd or item 1 of it = bufferCmd thenPut item 3 of it into TheSoundDataExit RepeatEnd IfEnd RepeatIf TheSoundData is empty thenAnswer "Can‚Äôt find any sound samples in that sound."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfGet NewHandle(0)If it < 0 thenAnswer "Error" && it && "allocating sound description handle."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfAddCleanup "DisposeHandle" && itPut it into SoundDescriptionGet DescribeSound(TheSoundData, SoundDescription)Put line 1 of it into SoundDataStartPut line 2 of it into SoundDataLengthPut line 3 of it into SampleRatePut line 4 of it into NrSampleFramesPut line 5 of it into DurationPerSampleGet NewHandle(SoundDataLength, false, true)If it < 0 thenAnswer "Error" && it && "allocating sound data handle."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfAddCleanup "DisposeHandle" && itPut it into SoundDataHandleHLock SoundDataHandleBlockMove SoundDataStart, HDeref(SoundDataHandle), SoundDataLengthHUnlock SoundDataHandleHUnlock TheSound -- TheSoundData, SoundDataStart, and pointer fields of TheSoundCommands, now invalid!Get NewMovie()If it < 0 thenAnswer "Error" && it && "creating sound movie."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfPut it into TheMovieGet NewMovieTrack(TheMovie, 0, 0, 1.0)If it = 0 thenGet GetMoviesError()Answer "Error" && it && "creating track for sound movie."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfPut it into TheTrackGet NewTrackMedia(TheTrack, "soun", Round(SampleRate), MovieFileName)If it = 0 thenGet GetMoviesError()Answer "Error" && it && "creating medium for sound movie."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfPut it into TheMediaBeginMediaEdits TheMediaGet AddMediaSample(TheMedia, SoundDataHandle, "", "", ¬¨DurationPerSample, SoundDescription, NrSampleFrames, 0)If it < 0 thenAnswer "Error" && it && "adding sound samples to medium."PopCleanup CleanupLevelExit NewMovieFromSoundResourceEnd IfEndMediaEdits TheMediaInsertMediaIntoTrack TheTrack, "", 0, GetMediaDuration(TheMedia)--Put true into MovieOKPopCleanup CleanupLevelReturn TheMovieEnd NewMovieFromSoundResourceOn AllDone-- signals completion of a conversion.Notify -- in case user has pushed me into the backgroundPlay "Harpsichord" tempo 200 "d ge f# g"End AllDone---- The conversion functions--On ConvertPICStoMovie-- moved to card script because of lack of room.Go to card id 3783Send "ConvertPICStoMovie" to this cardEnd ConvertPICStoMovieOn ConvertPICTfilesToMovie-- moved to card script because of lack of room.Go to card id 3783Send "ConvertPICTfilesToMovie" to this cardEnd ConvertPICTfilesToMovieOn ConvertMovieToPICS-- converts the video data from a QuickTime movie into-- a PICS file (containing a sequence of PICT resources).Put PushCleanup() into CleanupLevelAnswer file "Select movie file to convert:" of type "MooV"If it is empty thenPopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfPut it into MovieFileNameAsk file "PICS file to create?" with FileNamePart(MovieFileName) & ".PICS"If it is empty thenPopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfPut it into PICSfileNameGet NewMovieFromFile(MovieFileName)If it < 0 thenAnswer "Error" && it && "loading movie."PopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfPut it into TheMovieAddCleanup "DisposeMovie" && it-- create a dummy offscreen 32-bit GWorld, to force the movie-- to enable its highest-quality video tracks.Get CreateGWorld(32, "0,0,1,1")If it < 0 thenAnswer "Error" && it && "creating offscreen GWorld."PopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfPut it into TheGWorldAddCleanup "DisposeGWorld" && itSetMovieGWorld TheMovie, TheGWorld, GetGWorldDevice(TheGWorld)CreateResFile PICSfileName, "PICS", "MMDR", trueGet the resultIf it is not empty thenAnswer "Error" && it && "creating PICS file."PopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfGet OpenResFile(PICSfileName, true)If it < 0 thenAnswer "Error" && it && "opening PICS file."PopCleanup CleanupLevelExit ConvertMovieToPICSElse If it is empty thenAnswer "Hmm, that file is already open." with "Uh-oh"PopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfPut it into PICSfileAddCleanup "CloseResFile" && itPut 32 into resPurgeablePut 0 into nextTimeMediaSamplePut 14 into nextTimeEdgeOKPut 15 into nextTimeIgnoreActiveSegmentPut BSet(0, nextTimeMediaSample, nextTimeEdgeOK, ¬¨nextTimeIgnoreActiveSegment) into SearchFlagsPut 0 into MovieTimePut 0 into LargestPictureSizePut 0 into FrameCountPut 32767 - 128 + 1 into MaxFrameCount -- max nr frames a PICS file can containRepeatSet cursor to busyPut MovieTime into LastMovieTimeGet line 1 of GetMovieNextInterestingTime(TheMovie, SearchFlags, ¬¨"vide", MovieTime, true)If it is empty thenExit RepeatEnd IfPut it into MovieTimeIf not BTst(SearchFlags, nextTimeEdgeOK) and MovieTime = LastMovieTime thenAnswer "QuickTime bug! Stuck at movie time" && MovieTime & "!"Exit RepeatEnd IfIf FrameCount = MaxFrameCount thenAnswer "Too many frames in movie!"Exit RepeatEnd IfGet GetMoviePict(TheMovie, MovieTime)If it < 0 thenAnswer "Error" && it && "getting movie picture."Exit RepeatEnd IfPut it into ThisFrameAdd 1 to FrameCountAddResource PICSfile, ThisFrame, "PICT", 127 + FrameCount, "", resPurgeableUpdateResFile PICSfileGet GetHandleSize(ThisFrame)If it > LargestPictureSize thenPut it into LargestPictureSizeEnd IfReleaseResource ThisFramePut BClr(SearchFlags, nextTimeEdgeOK) into SearchFlagsEnd RepeatIf FrameCount = 0 thenAnswer "No video frames in movie!" with "Cancel"PopCleanup CleanupLevelExit ConvertMovieToPICSEnd IfPut GetMovieTimeScale(TheMovie) into MovieTimeScalePut FrameCount * MovieTimeScale / MovieTime into FrameRate -- average movie frame rateIf FrameRate < 1.0 then-- represent as nearest integer number of seconds per framePut Round(1.0 / FrameRate) into PICSFrameRateIF PICSFrameRate = 0 thenPut 1 into PICSFrameRateEnd IfPut -PICSFrameRate into PICSFrameRateElse-- represent as nearest integer number of frames per secondPut Round(FrameRate) into PICSFrameRateEnd IfPut empty into PICSinfoPut 1 into line 1 of PICSinfoPut 16 into line 2 of PICSinfo -- should determine actual depth?Put PICSFrameRate into line 3 of PICSinfoPut 0 into line 4 of PICSinfoPut "????" into line 5 of PICSinfoPut LargestPictureSize into line 6 of PICSinfoPut MakePICSInfo(PICSinfo) into PICSinfoAddResource PICSfile, PICSinfo, "INFO", 128, "", resPurgeableUpdateResFile PICSfilePopCleanup CleanupLevelAllDoneEnd ConvertMovieToPICSOn ConvertMovietoPICTfiles-- converts the video data from a QuickTime movie into-- a sequentially-numbered series of PICT files.Put PushCleanup() into CleanupLevelAnswer file "Select movie file to convert:" of type "MooV"If it is empty thenPopCleanup CleanupLevelExit ConvertMovietoPICTfilesEnd IfPut it into MovieFileNamePut "001" into DefaultSuffixGet PutFile("First PICT file to create?", ¬¨FileNamePart(MovieFileName) && DefaultSuffix)If it is empty thenPopCleanup CleanupLevelExit ConvertMovietoPICTfilesEnd IfPut it into FirstPictureFileGet FindNumberSuffix(FirstPictureFile)If it ‚↠empty thenPut the length of FirstPictureFile - it into SuffixLengthPut char (it + 1) to (the length of FirstPictureFile) ¬¨of FirstPictureFile into CurrSuffixPut char 1 to it of FirstPictureFile into NamePrefixElsePut FirstPictureFile & " " into NamePrefixPut DefaultSuffix into CurrSuffixPut the length of CurrSuffix into SuffixLengthEnd IfGet NewMovieFromFile(MovieFileName)If it < 0 thenAnswer "Error" && it && "loading movie."PopCleanup CleanupLevelExit ConvertMovietoPICTfilesEnd IfPut it into TheMovieAddCleanup "DisposeMovie" && it-- create an offscreen 32-bit GWorld, to force the movie-- to enable its highest-quality video tracks.Get CreateGWorld(32, "0,0,1,1")If it < 0 thenAnswer "Error" && it && "creating offscreen GWorld."PopCleanup CleanupLevelExit ConvertMovietoPICTfilesEnd IfPut it into TheGWorldAddCleanup "DisposeGWorld" && itSetMovieGWorld TheMovie, TheGWorld, GetGWorldDevice(TheGWorld)--Put 0 into nextTimeMediaSamplePut 14 into nextTimeEdgeOKPut 15 into nextTimeIgnoreActiveSegmentPut BSet(0, nextTimeMediaSample, nextTimeEdgeOK, ¬¨nextTimeIgnoreActiveSegment) into SearchFlagsPut 0 into MovieTimePut false into FrameFoundRepeatSet cursor to busyPut MovieTime into LastMovieTimeGet line 1 of GetMovieNextInterestingTime(TheMovie, SearchFlags, ¬¨"vide", MovieTime, true)If it is empty thenExit RepeatEnd IfPut it into MovieTimeIf not BTst(SearchFlags, nextTimeEdgeOK) and MovieTime = LastMovieTime thenAnswer "QuickTime bug! Stuck at movie time" && MovieTime & "!"Exit RepeatEnd IfGet GetMoviePict(TheMovie, MovieTime)If it < 0 thenAnswer "Error" && it && "getting movie picture."Exit RepeatEnd IfPut it into ThisFramePictureToFile ThisFrame, NamePrefix & CurrSuffix, "ttxt"Get the resultIf it is not empty thenAnswer "Error" && it && "saving movie frame."Exit RepeatEnd IfDisposePicture ThisFramePut true into FrameFoundPut the numberformat into SaveNumberFormatSet numberformat to RepeatString("0", SuffixLength)Add 1 to CurrSuffixPut "" & CurrSuffix into CurrSuffix -- force it to become a stringSet numberformat to SaveNumberFormatPut BClr(SearchFlags, nextTimeEdgeOK) into SearchFlagsEnd RepeatIf not FrameFound thenAnswer "No video frames in movie!"End IfPopCleanup CleanupLevelAllDoneEnd ConvertMovietoPICTfilesOn ConvertSoundFileToMovie-- converts various formats of sound files to-- sound-only QuickTime movies.Global MovieOKPut PushCleanup() into CleanupLevelAnswer file "Sound file to convert:" of type ¬¨"FSSD" or "AIFF" or "AIFC" or "sfil"If it is empty thenPopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfPut it into SoundFileNameAsk file "Where to save the movie?"If it is empty thenPopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfPut it into MovieFileNameSet cursor to watchPut 30 into createMovieFileDontCreateMoviePut 31 into createMovieFileDeleteCurFileGet CreateMovieFile(MovieFileName, "", "", ¬¨BSet(0, createMovieFileDontCreateMovie, createMovieFileDeleteCurFile))If line 1 of it < 0 thenAnswer "Error" && it && "creating movie file."PopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfPut line 1 of it into TheMovieFileAddCleanup "CloseMovieFile" && TheMovieFileGet FileType(SoundFileName)If SameOSType(it, "FSSD") thenGet NewMovieFromSoundFile(SoundFileName)Else If SameOSType(it, "AIFF") thenGet NewMovieFromAIFFile(SoundFileName, "", "", false)Else If SameOSType(it, "AIFC") thenGet NewMovieFromAIFFile(SoundFileName, "", "", true)Else If SameOSType(it, "sfil") thenGet NewMovieFromSoundResource(SoundFileName, ¬¨FileNamePart(SoundFileName), MovieFileName)If not MovieOK thenIf it ‚↠0 thenDisposeMovie itEnd IfPopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfElse-- shouldn‚Äôt occurAnswer "Unrecognized file type ‚Äú" && it & "‚Äù."PopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfIf it ‚⧠0 thenAnswer "Error" && it && "creating movie from sound file."PopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfPut it into TheMovieAddCleanup "DisposeMovie" && itGet AddMovieResource(TheMovie, TheMovieFile)If it < 0 thenAnswer "Error" && it && "saving movie in movie file."PopCleanup CleanupLevelExit ConvertSoundFileToMovieEnd IfPopCleanup CleanupLevelAllDoneEnd ConvertSoundFileToMovieOn ConvertMovieToSoundFile-- converts a sound track of a QuickTime movie-- to an AIFF file.Put PushCleanup() into CleanupLevelAnswer file "Movie to convert:" of type "MooV"If it is empty thenPopCleanup CleanupLevelExit ConvertMovieToSoundFileEnd IfPut it into MovieFileNameAsk file "AIFF file to create?" with ¬¨FileNamePart(MovieFileName) && "sound"If it is empty thenPopCleanup CleanupLevelExit ConvertMovieToSoundFileEnd IfPut it into SoundFileNameGet NewMovieFromFile(MovieFileName)If it < 0 thenAnswer "Error" && it && "loading movie."PopCleanup CleanupLevelExit ConvertMovieToSoundFileEnd IfPut it into TheMovieAddCleanup "DisposeMovie" && itPut GetMovieTracks(TheMovie) into TheTracksRepeatIf TheTracks is empty thenPut empty into TheTrackExit RepeatEnd IfGet line 1 of TheTracksIf SameOSType(GetTrackMediaType(it), "soun") thenPut it into TheTrackExit RepeatEnd IfDelete line 1 of TheTracksEnd RepeatIf TheTrack is empty thenAnswer "No sound track in movie."PopCleanup CleanupLevelExit ConvertMovieToSoundFileEnd IfExtractSoundToAIFFile GetTrackMedia(TheTrack),,, SoundFileName, ¬¨"SFX!", trueGet the resultIf it is not empty thenAnswer "Error" && it && "doing conversion."PopCleanup CleanupLevelExit ConvertMovieToSoundFileEnd IfPopCleanup CleanupLevelAllDoneEnd ConvertMovieToSoundFile---- Management of Conversion menu--On CreateConversionMenuCreate menu "Conversion"Put "PICS file to Movie..." after menu "Conversion" ¬¨with MenuMsg "ConvertPICStoMovie"Put "Movie to PICS file..." after menu "Conversion" ¬¨with MenuMsg "ConvertMovieToPICS"Put "-" after menu "Conversion"Put "PICT file sequence to Movie..." after menu "Conversion" ¬¨with MenuMsg "ConvertPICTfilesToMovie"Put "Movie to PICT file sequence..." after menu "Conversion" ¬¨with MenuMsg "ConvertMovietoPICTfiles"Put "-" after menu "Conversion"Put "Sound file to movie..." after menu "Conversion" ¬¨with MenuMsg "ConvertSoundFileToMovie"Put "Movie to sound file..." after menu "Conversion" ¬¨with MenuMsg "ConvertMovieToSoundFile"Put "-" after menu "Conversion"Put "Conversion settings" after menu "Conversion" ¬¨with MenuMsg "Go to card id 3783"End CreateConversionMenuOn DeleteConversionMenuIf there is a menu "Conversion" thenDelete menu "Conversion"End IfEnd DeleteConversionMenu---- Top-level handlers--On OpenBackgroundCreateConversionMenuEnd OpenBackgroundOn CloseBackgroundDeleteConversionMenuEnd CloseBackgroundOn SuspendStackDeleteConversionMenuPass SuspendStackEnd SuspendStackOn ResumeStackCreateConversionMenuPass ResumeStackEnd ResumeStack</script>
  12. </background>
  13.